<template>
  <el-dialog
    class="base-dialog"
    :title="title"
    :visible.sync="isShowDialog"
    :append-to-body="true"
    :before-close="handleCloseDialog"
    custom-class="panna-dialog_medium"
    @closed="closedDialog"
  >
    <p slot="title">{{ title }}</p>
    <div class="main-container" style="height: 100%">
      <el-tabs v-model="activeName" @tab-click="handleClick">
        <el-tab-pane :label="customer.projectUnitPrice" name="first">
          <CustomerDetectionItemPrice
            v-if="activeName == 'first'"
            ref="CustomerDetectionItemPrice"
            :edit-id="editId"
          />
        </el-tab-pane>
        <el-tab-pane :label="customer.agreementDiscount" name="second">
          <CustomerDiscountRate
            v-if="activeName == 'second'"
            ref="CustomerDiscountRate"
            :edit-id="editId"
          />
        </el-tab-pane>
      </el-tabs>
    </div>
  </el-dialog>
</template>
<script>
import CustomerDetectionItemPrice from "./CustomerDetectionItemPrice.vue";
import CustomerDiscountRate from "./CustomerDiscountRate.vue";

export default {
  name: "CustomerDetectionItemPriceDialog",
  components: {
    CustomerDiscountRate,
    CustomerDetectionItemPrice,
  },
  props: {
    editId: {
      type: [String, Number],
      default: "",
    },
    isShowDialog: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      title: this.$t("Customer.setCustomerPrice"),
      activeName: "first",
    };
  },
  computed: {
    operateType() {
      return this.$t("ModuleSysBusiness.OperateType") || {};
    },
    customer() {
      return this.$t("Customer") || {};
    },
  },
  mounted() {},
  created() {},
  methods: {
    handleClick() {},

    // 关闭弹框
    handleClose() {
      // 动画结束后在清空表单 防止页面闪烁
      this.$emit("update:isShowDialog", false);
    },
    // 关闭客户弹框没保存
    handleCloseDialog() {
      // 动画结束后在清空表单 防止页面闪烁
      this.$emit("update:isShowDialog", false);
    },
    // 关闭弹框动画结束
    closedDialog() {
      // 动画结束后在清空表单 防止页面闪烁
    },
    handleCloseChildDialog() {
      this.$refs["ruleForm"].resetFields();
      this.isShowChildDialog = false;
    },
    closedChildDialog() {
      this.$refs["ruleForm"].resetFields();
      this.isShowChildDialog = false;
    },
  },
};
</script>
